package com.code.base.acc.service;

import java.util.List;
import java.util.Date;
import java.util.Map;
import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.code.base.acc.persistence.AccSpMapper;
import com.code.base.acc.pojo.AccSp;
import com.code.util.PrimaryKeyUtil;


@Service
public class AccSpService {


	@Resource
	private AccSpMapper accSpMapper;

	public Long getInsertId() {
		return PrimaryKeyUtil.generatePrimaryKey();
	}

	public AccSp getDataById(Long id) {
		return accSpMapper.getDataById(id);
	}

	public List<AccSp> getAllData() {
		return accSpMapper.getAllData();
	}

	public int getDataCountByCondition(AccSp entity) {
		return accSpMapper.getDataCountByCondition(entity);
	}

	public List<AccSp> getDataByCondition(AccSp entity) {
		return accSpMapper.getDataByCondition(entity);
	}

	public int getDataCountByLikeCondition(AccSp entity) {
		return accSpMapper.getDataCountByLikeCondition(entity);
	}

	public List<AccSp> getDataByLikeCondition(AccSp entity) {
		return accSpMapper.getDataByLikeCondition(entity);
	}

	public List<AccSp> getDataByIds(Long[] ids) {
		return accSpMapper.getDataByIds(ids);
	}

	public void insertData(AccSp entity) {
		insertData(entity, true);
	}

	public void insertData(AccSp entity, boolean setIdValue) {
		if (setIdValue) {
			entity.setId(getInsertId());
		}
		accSpMapper.insertData(entity);
	}

	public void updateData(AccSp entity) {
		accSpMapper.updateData(entity);
	}

	public void updateDataByParam(Map<String, Object> map) {
		if (map.size() == 0)
			return;

		accSpMapper.updateDataByParam(map);
	}

	public void deleteDataByObject(AccSp entity) {
		accSpMapper.deleteDataByObject(entity);
	}

	public void deleteDataById(Long id) {
		accSpMapper.deleteDataById(id);
	}

	public void deleteDataByIds(Long[] ids) {
		accSpMapper.deleteDataByIds(ids);
	}

}
